package cn.fl.risk.controller;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cn.cmm.base.framework.utils.*;
import cn.fl.framework.handler.ResponseFilter;
import cn.fl.project.service.IPrjBscInfoService;
import cn.fl.risknew.service.IRskCommRecNewService;
import cn.fl.system.service.IEncrptStrategy;
import net.sf.json.JSONArray;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.socket.TextMessage;

import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.fl.capital.condition.CapRemindDataInfoQueryCondition;
import cn.fl.customer.service.ICstBscInfoService;
import cn.fl.customer.vo.CstBscInfoVO;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.risk.condition.RskCommRecQueryCondition;
import cn.fl.risk.constant.RiskConstant;
import cn.fl.risk.dto.RskCommRecDTO;
import cn.fl.risk.service.IRskCommRecService;
import cn.fl.risk.util.SpringWebSocketHandler;
import cn.fl.risk.vo.RskCommRecVO;
import cn.fl.system.constant.SysLogConstant;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import fl.customer.facade.customer.dto.CstContactInfoDTO;

/**
 * @Description: 沟通记录表 控制层
 */
@Controller
@RequestMapping("/risk/rskCommRec")
public class RskCommRecController extends BaseController {
	private static final Logger logger = LoggerFactory.getLogger(RskCommRecController.class);

    /**
     * RskCommRec 服务层BEAN
     */
    @Autowired
    private IRskCommRecService rskCommRecService;
    @Autowired
    private IRskCommRecNewService rskCommRecNewService;
    /**
     * 客户 服务层BEAN
     */
    @Autowired
    private ICstBscInfoService cstBscInfoService;
    @Autowired
    private IPrjBscInfoService prjBscInfoService;//项目基础信息表
    @Autowired
    private IEncrptStrategy needEncrptStrategy;

    /**
     * 数据字典服务
     */
    @Autowired
    private ISysDictionaryApiService sysDictionaryApiService;
    
    @Bean//这个注解会从Spring容器拿出Bean
    public SpringWebSocketHandler infoHandler() {
        return new SpringWebSocketHandler();
    }

    /*******************************
     * 到沟通记录管理页面
     *******************************/
    @RequestMapping(value = "/toMgrPage.do", method = {RequestMethod.GET})
    public ModelAndView toMgrPage(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.info(logger, "toListPage", "加载到沟通记录管理页面.", CurrentThreadContext.getCurrentUserName());
        ModelAndView mav = new ModelAndView("risk/rskCommRec/rskCommRec");
        return mav;
    }

    /**
     * 到列表页面
     */
    @RequestMapping(value = "/toListPage.do", method = {RequestMethod.GET})
    public ModelAndView toListPage(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.info(logger, "toListPage", "加载RskCommRec列表页面.", CurrentThreadContext.getCurrentUserName());
        ModelAndView mav = new ModelAndView("risk/rskCommRec/rskCommRecList");
        String qt = request.getParameter("qt");//查询类型 1.查询列表+可添加删除  2.查询列表
        String cstId = request.getParameter("cstId");//客户ID
        String cstNm = request.getParameter("cstNm");//客户名称
        String buTypCd = request.getParameter("buTypCd");//沟通业务类型：1.逾期催收 2.租金提醒 3.续保提醒 4.起租提醒
        String bizNo = request.getParameter("bizNo");//沟通业务编号：3.续保提醒业务编号为合同号
        if ("1".equals(qt)) {
            if (RiskConstant.CODE_BU_TYP_CD_1.equals(buTypCd)) {
                mav.setViewName("risk/rskCommRec/rskRecModifyList");
            } else if (RiskConstant.CODE_BU_TYP_CD_2.equals(buTypCd)) {
                // 客户反馈受新型肺炎影响
                List<KeyValueVO> cstFeedbackCdList = sysDictionaryApiService.getKvList(cn.fl.risknew.constant.RiskConstant.CST_FEEDBACK_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
                if (CollectionUtils.isNotEmpty(cstFeedbackCdList)) {
                    mav.addObject("cstFeedbackCdList", cstFeedbackCdList);
                }
                // 公司审批受新型肺炎影响
                List<KeyValueVO> compFeedbackCdList = sysDictionaryApiService.getKvList(cn.fl.risknew.constant.RiskConstant.COMP_FEEDBACK_CD, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
                if (CollectionUtils.isNotEmpty(compFeedbackCdList)) {
                    mav.addObject("compFeedbackCdList", compFeedbackCdList);
                }
                // 贷后风险核查
                List<KeyValueVO> postLoanRskInfoList = sysDictionaryApiService.getKvList("RSK0028", CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
                if (CollectionUtils.isNotEmpty(postLoanRskInfoList)) {
                    mav.addObject("postLoanRskInfoList", postLoanRskInfoList);
                }
                mav.setViewName("risk/rskCommRec/rskRentRecModifyList");
            } else if (RiskConstant.CODE_BU_TYP_CD_3.equals(buTypCd)) {
                mav.setViewName("risk/rskCommRec/rskRenewRecModifyList");
            } else {
                mav.setViewName("risk/rskCommRec/rskRecModifyList");
            }

            RskCommRecVO rskCommRecVO = new RskCommRecVO();
            rskCommRecVO.setCstId(Long.valueOf(cstId));
            rskCommRecVO.setCstNm(cstNm);

            //查询客户联系人信息
            List<Long> idList = new ArrayList<>(1);
            idList.add(rskCommRecVO.getCstId());
            List<CstContactInfoDTO> cstContactInfoDTOList = this.rskCommRecService.searchCstLkMan(idList);
            if (CollectionUtils.isNotEmpty(cstContactInfoDTOList)) {
                CstContactInfoDTO contactInfoDTO = cstContactInfoDTOList.get(0);
                rskCommRecVO.setLkPhone(contactInfoDTO.getMp1());//联系人电话
                rskCommRecVO.setLkMan(contactInfoDTO.getCstNm());//联系人名称
            }
            CstBscInfoVO cstBscInfoVO = cstBscInfoService.selectById(rskCommRecVO.getCstId());
            if (null != cstBscInfoVO) {
                rskCommRecVO.setPayTypCd(cstBscInfoVO.getPayTypCd());
            }
            rskCommRecVO.setCollectTms(DateUtils.formatDateToString(new Date(), DateUtils.YYYY_MM_DDHHMM));
            rskCommRecVO.setCollectUsrId(CurrentThreadContext.getCurrentUserId());
            rskCommRecVO.setCollectUsrNm(CurrentThreadContext.getCurrentUserName());
            rskCommRecVO.setPreLoanRskInfo(this.rskCommRecNewService.searchPreLoanRskInfo(Long.valueOf(cstId)));
            mav.addObject("rskCommRecVO", rskCommRecVO);
        } else {
            // 事业部
            List<KeyValueVO> orgList = this.cstBscInfoService.searchBusinessOrgList();
            mav.addObject("buOrgCdList", JSON.toJSONString(orgList));
            // 所属区域
            List<KeyValueVO> regionList = this.prjBscInfoService.getRegionList();
            mav.addObject("regionList", JSON.toJSONString(regionList));
            if (RiskConstant.CODE_BU_TYP_CD_1.equals(buTypCd)) {
                mav.setViewName("risk/rskCommRec/rskCommRecList");
            } else if (RiskConstant.CODE_BU_TYP_CD_2.equals(buTypCd)) {
                mav.setViewName("risk/rskCommRec/rskRentRecList");
            } else {
                mav.setViewName("risk/rskCommRec/rskCommRecList");
            }
        }
        mav.addObject("cstId", request.getParameter("cstId"));
        mav.addObject("buTypCd", buTypCd);
        mav.addObject("bizNo", bizNo);//业务编号
        this.prepare(request, mav);
        return mav;
    }

    /**
     * 沟通记录列表
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/toRecListPage.do", method = {RequestMethod.GET})
    public ModelAndView toRecListPage(HttpServletRequest request, HttpServletResponse response){
        BaseLogUtils.info(logger,"toRecListPage","加载沟通记录列表",CurrentThreadContext.getCurrentUserName());
        String buTypCd = request.getParameter("buTypCd");//沟通业务类型：1.逾期催收 2.租金提醒 3.续保提醒 4.起租提醒
        ModelAndView mav = new ModelAndView();
        mav.addObject("buTypCd",buTypCd);
        if(RiskConstant.CODE_BU_TYP_CD_1.equals(buTypCd)){
            mav.setViewName("risk/rskCommRec/rskCommRecList");
        }else if(RiskConstant.CODE_BU_TYP_CD_2.equals(buTypCd)){
            mav.setViewName("risk/rskCommRec/rskRentRecList");
        }else if(RiskConstant.CODE_BU_TYP_CD_4.equals(buTypCd)){
            mav.setViewName("risk/rskCommRec/rskRentRecList");
        }else{
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_700);
        }
        // 事业部
        List<KeyValueVO> orgList = this.cstBscInfoService.searchBusinessOrgList();
        if (CollectionUtils.isNotEmpty(orgList)) {
            mav.addObject("buOrgCdList", JSON.toJSONString(orgList));
        }
        //沟通方式
        List<KeyValueVO> collectWayCdList = this.rskCommRecService.getCollectWayCdList();
        if (CollectionUtils.isNotEmpty(collectWayCdList)) {
            mav.addObject("collectWayCdList", JSON.toJSONString(collectWayCdList));
        }
        //外呼结果
        List<KeyValueVO> commStsCdList = this.rskCommRecService.getCommStsCdList();
        if (CollectionUtils.isNotEmpty(commStsCdList)) {
            mav.addObject("commStsCdList", JSON.toJSONString(commStsCdList));
        }

        return mav;
    }

    /**
     * 到新增页面
     */
    @RequestMapping(value = "/toAddPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toAddPage(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.info(logger, "toAddPage", "加载RskCommRec Add页面.", CurrentThreadContext.getCurrentUserName());
        ModelAndView mav = new ModelAndView("risk/rskCommRec/rskCommRecModify");
        //this.prepare(request,mav);
        return mav;
    }

    /**
     * 到修改页面
     */
    @RequestMapping(value = "/toModifyPage.do", method = {RequestMethod.GET, RequestMethod.POST})
    public ModelAndView toModifyPage(HttpServletRequest request, HttpServletResponse response) {
        BaseLogUtils.info(logger, "toModifyPage", "加载RskCommRec Modify页面.", CurrentThreadContext.getCurrentUserName());
        ModelAndView mav = new ModelAndView("risk/rskCommRec/rskCommRecModify");
        //this.prepare(request,mav);

        String id = request.getParameter("id");
        RskCommRecVO rskCommRecVO = this.rskCommRecService.selectById(Long.valueOf(id));

        if(null != rskCommRecVO){//关键字转换 FUJINGRUN
            String cstNm = rskCommRecVO.getCstNm();
            if(StringUtils.isNotEmpty(cstNm)){
                for (String key : ResponseFilter.keyList) {
                    if (cstNm.contains(key)) {
                        cstNm = cstNm.replace(key, ResponseFilter.convertKeyMap.get(key));
                    }
                }
                rskCommRecVO.setCstNm(cstNm);
            }
        }
        mav.addObject("rskCommRecVO", rskCommRecVO);
        return mav;
    }

    //加载数据字典数据、传值等 ？
    public void prepare(HttpServletRequest request, ModelAndView mav) {
        //逾期催收方式
        List<KeyValueVO> collectWayCdList = this.rskCommRecService.getCollectWayCdList();
        if (CollectionUtils.isNotEmpty(collectWayCdList)) {
            mav.addObject("collectWayCdList", JSON.toJSONString(collectWayCdList));
        }
        //逾期催收结果
        List<KeyValueVO> collectRstCdList = this.rskCommRecService.getCollectRstCdList();
        if (CollectionUtils.isNotEmpty(collectRstCdList)) {
            mav.addObject("collectRstCdList", JSON.toJSONString(collectRstCdList));
        }
        //逾期原因
        List<KeyValueVO> ovdReasonCdList = this.rskCommRecService.getOvdReasonCdList();
        if (CollectionUtils.isNotEmpty(ovdReasonCdList)) {
            mav.addObject("ovdReasonCdList", JSON.toJSONString(ovdReasonCdList));
        }
        //还款方式
        List<KeyValueVO> payTypCdList = this.rskCommRecService.getPayTypCdList();
        if (CollectionUtils.isNotEmpty(payTypCdList)) {
            mav.addObject("payTypCdList", JSON.toJSONString(payTypCdList));
        }
    }

    /**
     * 初始化列表
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/initList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initRskCommRecList(HttpServletRequest request, HttpServletResponse response) {
        String currentPage = request.getParameter("page");
        String pageSize = request.getParameter("pagesize");
        Pager page = new Pager();
        if (StringUtils.isNotEmpty(currentPage)) {
            page.setCurrentPage(Integer.parseInt(currentPage));
        }

        if (StringUtils.isNotEmpty(pageSize)) {
            page.setEveryPage(Integer.parseInt(pageSize));
        }

        RskCommRecQueryCondition qc = new RskCommRecQueryCondition();
        String cstId = request.getParameter("cstId");
        String cstNm = request.getParameter("cstNm");
        String collectUsrNm = request.getParameter("collectUsrNm");
        String buTypCd = request.getParameter("buTypCd");
        String buOrgCd = request.getParameter("buOrgCd");
        String startCollectTm = request.getParameter("startCollectTm");
        String endCollectTm = request.getParameter("endCollectTm");
        String bizNo = request.getParameter("bizNo");
        String collectWayCd = request.getParameter("collectWayCd");
        String commStsCd = request.getParameter("commStsCd");
        String cstMgrRgnCd = request.getParameter("cstMgrRgnCd");
        String certNo = request.getParameter("certNo");

        if (StringUtils.isNotEmpty(cstMgrRgnCd)) {
            qc.setCstMgrRgnCd(cstMgrRgnCd);
        }
        if (StringUtils.isNotBlank(buOrgCd)) {
            qc.setBuOrgCd(buOrgCd);
        }
        if (StringUtils.isNotBlank(startCollectTm)) {
            qc.setStartCollectTm(startCollectTm);
        }
        if (StringUtils.isNotBlank(endCollectTm)) {
            qc.setEndCollectTm(endCollectTm);
        }
        if (StringUtils.isNotEmpty(cstId)) {
            qc.setCstId(Long.valueOf(cstId));
        }
        if (StringUtils.isNotBlank(cstNm)) {
            qc.setCstNm(cstNm);
        }
        if (StringUtils.isNotBlank(collectUsrNm)) {
            qc.setCollectUsrNm(collectUsrNm);
        }
        if (StringUtils.isNotBlank(buTypCd)) {
            qc.setBuTypCd(buTypCd);
        }
        if (StringUtils.isNotBlank(bizNo)) {
            qc.setBizNo(bizNo);
        }
        if(StringUtils.isNotBlank(collectWayCd)){
            qc.setCollectWayCd(collectWayCd);
        }
        if(StringUtils.isNotBlank(commStsCd)){
        	qc.setCommStsCd(commStsCd);
        }
        if(StringUtils.isNotBlank(certNo)){
            qc.setCertNo(certNo);
        }
        qc.setRoleId(CurrentThreadContext.getCurrentRoleId());
        page.setCondition(qc);

        BaseLogUtils.info(logger, "initRskCommRecList", "初始化RskCommRec列表页面数据.DATA:" + JSONObject.toJSONString(page), CurrentThreadContext.getCurrentUserName());
        Pager pager = this.rskCommRecService.searchListPage(page);
        List<RskCommRecVO> list = (List<RskCommRecVO>) pager.getResultList();
        if(CollectionUtils.isNotEmpty(list) && needEncrptStrategy.isNeedEncrpt(CurrentThreadContext.getCurrentRoleId())){
            for (RskCommRecVO vo : list) {
                vo.setCertNo(EncryptUtil.certNoEncrypt(vo.getCertNo()));
            }
        }
        ListPageVO<RskCommRecVO> listPage = new ListPageVO<RskCommRecVO>(list, pager.getTotalCount());
        return listPage;
    }

    /**
     * 删除数据
     */
    @RequestMapping(value = "/removeByIds.do", method = {RequestMethod.POST})
    @ResponseBody
    public DataResultVO removeRskCommRecByIds(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String ids = request.getParameter("ids");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
        if (StringUtils.isEmpty(ids)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            BaseLogUtils.info(logger, "removeRskCommRecByIds", "删除RskCommRec数据,主键参数为空!", CurrentThreadContext.getCurrentUserName());
            return result;
        }

        List<Long> idsList = new ArrayList<Long>();
        JSONArray idsArray = JSONArray.fromObject(ids);
        for (Object object : idsArray) {
            idsList.add(Long.valueOf(object.toString()));
        }

        try {
            boolean success = this.rskCommRecService.removeByIds(idsList);
            if (!success) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
                BaseLogUtils.info(logger, "removeRskCommRecByIds", "删除RskCommRec数据失败,ID:" + idsList.toString(), CurrentThreadContext.getCurrentUserName());
            }
            BaseLogUtils.info(logger, "removeRskCommRecByIds", "删除RskCommRec数据成功,ID:" + idsList.toString(), CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.info(logger, "removeRskCommRecByIds", "删除RskCommRec数据失败,ID:" + idsList.toString() + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.error(logger, "removeRskCommRecByIds", "删除RskCommRec数据失败,系统错误.ID:" + idsList.toString() + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        return result;
    }

    /**
     * 得到一条记录
     *
     * @param request
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "/getById.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object getRskCommRecById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String id = request.getParameter("id");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
        if (StringUtils.isEmpty(id)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            BaseLogUtils.info(logger, "getRskCommRecById", "获取RskCommRec数据,主键参数为空.", CurrentThreadContext.getCurrentUserName());
            return result;
        }

        try {
            RskCommRecVO vo = this.rskCommRecService.selectById(Long.valueOf(id));
            if (null == vo) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
                BaseLogUtils.info(logger, "getRskCommRecById", "获取RskCommRec数据不存在,ID:" + id, CurrentThreadContext.getCurrentUserName());
            }
            result.setData(vo);
            BaseLogUtils.info(logger, "getRskCommRecById", "获取RskCommRec数据成功,ID:" + id, CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.info(logger, "getRskCommRecById", "获取RskCommRec数据失败,ID:" + id + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.error(logger, "getRskCommRecById", "获取RskCommRec数据失败,系统错误.ID:" + id + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        return result;
    }

    /**
     * 新增
     */
    @RequestMapping(value = "/add.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object addRskCommRec(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
        RskCommRecVO entity = null;//获取参数
        try {
            entity = this.getRequestParamForRskCommRec(request);//获取参数
            Long id = this.rskCommRecService.add(entity);
            result.setData(id);
            BaseLogUtils.info(logger, "addRskCommRec", "新增RskCommRec数据成功,ID:" + id + ".DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.info(logger, "addRskCommRec", "新增RskCommRec数据失败.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.error(logger, "addRskCommRec", "新增RskCommRec数据失败,系统错误.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        return result;
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/modify.do", method = {RequestMethod.POST})
    @ResponseBody
    public Object modifyRskCommRec(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
        RskCommRecVO entity = null;
        try {
            entity = this.getRequestParamForRskCommRec(request);
            if (entity.getId() == null) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
                BaseLogUtils.info(logger, "modifyRskCommRec", "修改RskCommRec信息,主键参数为空！.", CurrentThreadContext.getCurrentUserName());
                return result;
            }

            boolean success = this.rskCommRecService.modify(entity);
            if (!success) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo(SysLogConstant.LOG_CMM_UPDATE_FAIL);
                BaseLogUtils.info(logger, "modifyRskCommRec", "修改RskCommRec数据失败.DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
                return result;
            }
            BaseLogUtils.info(logger, "modifyRskCommRec", "修改RskCommRec数据成功.DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.info(logger, "modifyRskCommRec", "修改RskCommRec数据失败.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR + ex.getMessage());
            BaseLogUtils.error(logger, "modifyRskCommRec", "修改RskCommRec数据失败,系统错误.DATA:" + JSONObject.toJSONString(entity) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        return result;
    }

    /**
     * 导出沟通记录
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/exportCommRecList.do", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    public DataResultVO exportCommRecList(HttpServletRequest request, HttpServletResponse response) {
        RskCommRecQueryCondition qc = new RskCommRecQueryCondition();
        String cstId = request.getParameter("cstId");
        String cstNm = request.getParameter("cstNm");
        String collectUsrNm = request.getParameter("collectUsrNm");
        String buTypCd = request.getParameter("buTypCd");
        String buOrgCd = request.getParameter("buOrgCd");
        String startCollectTm = request.getParameter("startCollectTm");
        String endCollectTm = request.getParameter("endCollectTm");

        if (StringUtils.isNotBlank(buOrgCd)) {
            qc.setBuOrgCd(buOrgCd);
        }
        if (StringUtils.isNotBlank(startCollectTm)) {
            qc.setStartCollectTm(startCollectTm);
        }
        if (StringUtils.isNotBlank(endCollectTm)) {
            qc.setEndCollectTm(endCollectTm);
        }
        if (StringUtils.isNotEmpty(cstId)) {
            qc.setCstId(Long.valueOf(cstId));
        }
        if (StringUtils.isNotBlank(cstNm)) {
            qc.setCstNm(cstNm);
        }
        if (StringUtils.isNotBlank(collectUsrNm)) {
            qc.setCollectUsrNm(collectUsrNm);
        }
        if (StringUtils.isNotBlank(buTypCd)) {
            qc.setBuTypCd(buTypCd);
        }
        BaseLogUtils.info(logger, "exportCommRecList", "导出沟通记录" + JSON.toJSONString(qc));
        return this.rskCommRecService.exportCommRecList(qc);

        /*List<RskCommRecVO> voList = this.rskCommRecService.searchList(qc);
        Map<String, Object> map = new HashMap<>();
        map.put("commRecList", voList);
        map.put("buTypCd", buTypCd);
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        String filename = "";
        String now = DateUtils.formatDateToString(new Date(), DateUtils.YYYYMMDDHHMMSS);
        if (buTypCd.equals(RiskConstant.CODE_BU_TYP_CD_1)) {
            filename = "逾期催收记录" + now;
        } else if (buTypCd.equals(RiskConstant.CODE_BU_TYP_CD_2)) {
            filename = "租金提醒记录" + now;
        } else {
            filename = "沟通记录" + now;
        }
        response.setCharacterEncoding("utf-8");
        OutputStream os = null;
        try {
            filename = new String(filename.getBytes("utf-8"), "ISO8859-1");
            response.setHeader("Content-disposition", "attachment; filename=" + filename + ".xls");// 设定输出文件头
            response.setContentType("application/x-msdownload");// 定义输出类型
            baos = new ExportRiskUtil().exportCommRecXls(map);
            if (baos == null) {
                BaseLogUtils.error(logger, "exportCommRecList", "导出沟通记录失败");
                return;
            }
            os = response.getOutputStream();
            baos.writeTo(os);
            baos.flush();
            os.flush();
        } catch (UnsupportedEncodingException e) {
			BaseLogUtils.error(logger, "-", "异常", e);
            BaseLogUtils.error(logger, "exportCommRecList", "导出沟通记录失败" + e.getMessage());
        } catch (IOException e) {
			BaseLogUtils.error(logger, "-", "异常", e);
            BaseLogUtils.error(logger, "exportCommRecList", "导出沟通记录失败" + e.getMessage());
        } finally {
            //关闭流
            if (os != null) {
                try {
                    os.close();
                } catch (IOException e) {
			BaseLogUtils.error(logger, "-", "异常", e);
                }
            }
            if (baos != null) {
                try {
                    baos.close();
                } catch (IOException e) {
			BaseLogUtils.error(logger, "-", "异常", e);
                }
            }
        }*/
    }

    /**
     * 获取请求参数
     *
     * @param request 请求
     * @return
     */
    private RskCommRecVO getRequestParamForRskCommRec(HttpServletRequest request) throws BaseException {
        //获取参数
        String id = request.getParameter("id");//主键
        String cstId = request.getParameter("cstId");//客户ID
        String collectTm = request.getParameter("collectTm");//催收时间
        String collectWayCd = request.getParameter("collectWayCd");//催收方式RSK0001
        String collectUsrId = request.getParameter("collectUsrId");//催收员ID
        String ovdReasonCd = request.getParameter("ovdReasonCd");//欠款原因RSK0002
        String lkMan = request.getParameter("lkMan");//联系人
        String lkPhone = request.getParameter("lkPhone");//联系电话
        String collectRem = request.getParameter("collectRem");//催收记录
        String collectRstCd = request.getParameter("collectRstCd");//催收结果RSK0003
        String collectCost = request.getParameter("collectCost");//催收成本
        String createTime = request.getParameter("createTime");//创建时间
        String cstNm = request.getParameter("cstNm");//客户名称
        String collectUsrNm = request.getParameter("collectUsrNm");//催收人员名称
        String buTypCd = request.getParameter("buTypCd");//业务类型
        String bizNo = request.getParameter("bizNo");//业务编号
        String preLoanRskInfo = request.getParameter("preLoanRskInfo");//贷前风险标记
        String postLoanRskCd = request.getParameter("postLoanRskCd");//贷后风险核查
        // 客户反馈受新型肺炎影响
        String cstFeedbackCd = request.getParameter("cstFeedbackCd");
        // 公司审批受新型肺炎影响
        String compFeedbackCd = request.getParameter("compFeedbackCd");
        //验证参数并赋值
        RskCommRecVO entity = new RskCommRecVO();
        if (StringUtils.isNotEmpty(cstId)) {
            entity.setCstId(Long.valueOf(cstId));//客户ID
        }
        if (StringUtils.isNotEmpty(collectTm)) {
            entity.setCollectTm(DateUtils.formatStringToDate(collectTm, DateUtils.YYYY_MM_DD));//催收时间
        }else{
        
        	entity.setCollectTm(DateUtils.formatDate(new Date(), DateUtils.YYYY_MM_DD));//催收时间
        }

        entity.setCollectWayCd(collectWayCd);//催收方式RSK0001
        if (StringUtils.isNotEmpty(collectUsrId)) {
            entity.setCollectUsrId(Long.valueOf(collectUsrId));//催收员ID 
        }
        entity.setOvdReasonCd(ovdReasonCd);//欠款原因RSK0002
        entity.setLkMan(lkMan);//联系人
        entity.setLkPhone(lkPhone);//联系电话
        entity.setCollectRem(collectRem);//催收记录
        entity.setCollectRstCd(collectRstCd);//催收结果RSK0003
        entity.setCstFeedbackCd(cstFeedbackCd);
        entity.setCompFeedbackCd(compFeedbackCd);
        if (StringUtils.isNotBlank(collectCost)) {
            entity.setCollectCost(DecimalUtils.convertYuanToFen(Double.valueOf(collectCost)).longValue());//催收成本
        }
        entity.setCstNm(cstNm);
        entity.setCollectUsrNm(collectUsrNm);
        entity.setBuTypCd(buTypCd);
        entity.setBizNo(bizNo);
        if(StringUtils.isNotBlank(preLoanRskInfo)){
            entity.setPreLoanRskInfo(preLoanRskInfo);
        }
        if(StringUtils.isNotBlank(postLoanRskCd)){
            entity.setPostLoanRskCd(postLoanRskCd);
        }

        Date tm = new Date();
        if (StringUtils.isNotBlank(id)) {
            entity.setId(Long.valueOf(id));
            entity.setMdfTm(tm);
            entity.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
        } else {
            entity.setCrtTm(tm);
            entity.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
        }

        return entity;
    }
    /**
     * 逾期催收批量外呼
     * @param request
     * @param response
     * @return
     * @throws BaseException
     */
    @RequestMapping(value = "/outboundList.do", method = {RequestMethod.POST})
    @ResponseBody
    public DataResultVO outboundList(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "外呼成功");
        String ids = request.getParameter("ids");
        if (StringUtils.isEmpty(ids)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            BaseLogUtils.info(logger, "outboundList", "逾期催收外呼,主键参数为空!", CurrentThreadContext.getCurrentUserName());
            return result;
        }

        List<Long> idsList = new ArrayList<Long>();
        JSONArray idsArray = JSONArray.fromObject(ids);
        for (Object object : idsArray) {
            idsList.add(Long.valueOf(object.toString()));
        }

        RskCommRecQueryCondition condition = new RskCommRecQueryCondition();
        //客户idlist
        condition.setCstIds(idsList);
        //当前登录人id
        Long userId  = CurrentThreadContext.getCurrentUserId();
        //当前登录人名
        String userName = CurrentThreadContext.getCurrentUserName();
        condition.setCollectUsrId(userId);
        condition.setCollectUsrNm(userName);
        try {
        	result = this.rskCommRecService.ovdOutboundList(condition);
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.info(logger, "outboundList", "批量外呼失败,Condition:" + JSON.toJSONString(condition) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            BaseLogUtils.error(logger, "outboundList", "批量外呼失败,系统错误.Condition:" + JSON.toJSONString(condition) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        return result;
    }
    /**
     * 外呼系统话单推送
     */
    @RequestMapping(value = "/pushCdrInfo.do",method = { RequestMethod.GET ,RequestMethod.POST},  produces = "application/json;charset=UTF-8", consumes = "application/json;charset=UTF-8")
    @ResponseBody
    public String pushCdrInfo(HttpServletRequest request,@RequestBody String data)throws BaseException{
    	BaseLogUtils.info(logger,"pushCdrInfo","进入外呼推送话单 body="+data);
    	try{
    		JSONObject dataJson = JSONObject.parseObject(data);
    		JSONArray cdrList = JSONArray.fromObject(dataJson.get("cdr"));
    		List<RskCommRecDTO> listRskCommRecDTO = new ArrayList<RskCommRecDTO>();
    		if(cdrList != null && cdrList.size() > 0){
    			for(int i =0; cdrList.size() > i ; i++){
    				RskCommRecDTO dto = new RskCommRecDTO();
    				//JSONObject jsonObject = (JSONObject) cdrList.get(i);
    				JSONObject jsonObject = (JSONObject)JSONObject.parse(cdrList.getString(i));
    				if(StringUtils.isEmpty(jsonObject.getString("taskid")) || 
    						StringUtils.isEmpty(jsonObject.getString("callee_num")) ||
    						StringUtils.isEmpty(jsonObject.getInteger("call_lasts_time"))){
    					BaseLogUtils.info(logger, "pushCdrInfo", "外呼推送话单错误- 主要参数为空- data="+cdrList.getString(i), CurrentThreadContext.getCurrentUserName());
    					//普通电话也会推送 so 退出本次循环
    					continue;
    					//return "error--参数为空";
    				}
    				dto.setSerialNum(jsonObject.getString("taskid"));
    				dto.setLkPhone(jsonObject.getString("callee_num"));
    				dto.setCommSec(jsonObject.getInteger("call_lasts_time"));
    				if(StringUtils.isNotEmpty(jsonObject.getString("start_time"))){
    					dto.setCollectTm(DateUtils.formatStringToDate(jsonObject.getString("start_time"), DateUtils.YYYY_MM_DDHHMMSS));
    				}
    				listRskCommRecDTO.add(dto);
    			}
    			if(CollectionUtils.isEmpty(listRskCommRecDTO)){
    				BaseLogUtils.info(logger, "pushCdrInfo", "外呼推送话单 --数据为空", CurrentThreadContext.getCurrentUserName());
    				return "success";
    			}
    			DataResultVO resultVo = this.rskCommRecService.updateCommStsByTaskId(listRskCommRecDTO);
    			if(resultVo != null && (resultVo.getSuccess()+"").equals(BaseConstant.IS_YESNO_YES +"")){
    				return "success";
    			}else{
    				BaseLogUtils.info(logger, "pushCdrInfo", "外呼推送话单错误- - data="+data+"error info ="+resultVo.getInfo(), CurrentThreadContext.getCurrentUserName());
        			return "error--";
    			}
    		}else{
    			BaseLogUtils.info(logger, "pushCdrInfo", "外呼推送话单错误- 数据为空- data="+data, CurrentThreadContext.getCurrentUserName());
    			return "error--数据为空";
    		}
    	}catch(Exception e){
            BaseLogUtils.info(logger, "pushCdrInfo", "外呼推送话单错误 data="+data+"错误信息 e="+e.getMessage(), CurrentThreadContext.getCurrentUserName());
            return "error--e="+e.getMessage();
    	}
    }
    
    /**
    * 外呼系统话单状态推送（websocket 推送信息）
    */
   @RequestMapping(value = "/pushCallState.do",method = { RequestMethod.GET ,RequestMethod.POST},  produces = "application/json;charset=UTF-8", consumes = "application/json;charset=UTF-8")
   @ResponseBody
   public String pushCallState(HttpServletRequest request,@RequestBody String data)throws BaseException{
   	BaseLogUtils.info(logger,"pushCallState","进入外呼推送话单状态 body="+data);
   	try{
   		JSONObject dataJson = JSONObject.parseObject(data);
   		RskCommRecQueryCondition condition = new RskCommRecQueryCondition();
   		if(StringUtils.isNotEmpty(dataJson.getString("taskid")) && 
   				StringUtils.isNotEmpty(dataJson.getString("callee_num"))){
   			condition.setSerialNum(dataJson.getString("taskid"));
   			condition.setLkPhone(dataJson.getString("callee_num"));
   			List<RskCommRecVO> listVO = this.rskCommRecService.searchList(condition);
   			if(CollectionUtils.isNotEmpty(listVO)){
   				BaseLogUtils.info(logger,"pushCallState","进入外呼推送话单状态 进入推送消息"+JSON.toJSONString(listVO.get(0)) );
   				infoHandler().sendMessageToUser(listVO.get(0).getCollectUsrId()+"", new TextMessage(listVO.get(0).getCollectRem()));
   				return "success";
   			}else{
   				BaseLogUtils.info(logger, "pushCallState", "外呼推送话单状态错误  未查询到数据", CurrentThreadContext.getCurrentUserName());
   	   			return "error";
   			}
   		}else{
   			BaseLogUtils.info(logger, "pushCallState", "外呼推送话单状态错误  参数错误", CurrentThreadContext.getCurrentUserName());
   			return "error";
   		}
   	}catch(Exception e){
           BaseLogUtils.info(logger, "pushCallState", "外呼推送话单状态错误 data="+data+"错误信息 e="+e.getMessage(), CurrentThreadContext.getCurrentUserName());
           return "error--e="+e.getMessage();
   	}
   }
   /**
    * 到起租提醒页面
    */
   @RequestMapping(value = "/toStartRentPage.do", method = {RequestMethod.GET})
   public ModelAndView toStartRentPage(HttpServletRequest request, HttpServletResponse response) {
       BaseLogUtils.info(logger, "toStartRentPage", "到起租提醒页面.", CurrentThreadContext.getCurrentUserName());
       ModelAndView mav = new ModelAndView("risk/rskCommRec/rskStartRentList");
       mav.addObject("cstId", request.getParameter("cstId"));
       mav.addObject("paySchId",request.getParameter("paySchId"));
       this.prepare(request, mav);
       return mav;
   }
   /**
    * 起租提醒外呼
    * @param request
    * @param response
    * @return
    */
   @RequestMapping(value = "/toStartRent.do", method = {RequestMethod.POST})
   @ResponseBody
   public Object toStartRent(HttpServletRequest request, HttpServletResponse response) {
       BaseLogUtils.info(logger, "toStartRent", "起租提醒外呼.", CurrentThreadContext.getCurrentUserName());
       DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "外呼成功");
       //String cstId = request.getParameter("cstId");
       String paySchId = request.getParameter("paySchId");
       CapRemindDataInfoQueryCondition condition = new CapRemindDataInfoQueryCondition();
       if(StringUtils.isEmpty(paySchId)){
    	   BaseLogUtils.info(logger, "toStartRent", "起租提醒外呼错误.支付表id为空", CurrentThreadContext.getCurrentUserName());
    	   result.setSuccess(BaseConstant.IS_YESNO_NO);
    	   result.setInfo("起租提醒外呼错误.支付表id为空");
    	   return result;
       }
       //当前登录人id
       Long userId  = CurrentThreadContext.getCurrentUserId();
       if(StringUtils.isEmpty(userId)){
    	   BaseLogUtils.info(logger, "toStartRent", "起租提醒外呼错误.登录人id为空", CurrentThreadContext.getCurrentUserName());
    	   result.setSuccess(BaseConstant.IS_YESNO_NO);
    	   result.setInfo("起租提醒外呼错误.登录人id为空");
    	   return result;
       }
       condition.setUserId(userId);
       condition.setCollectUsrNm(CurrentThreadContext.getCurrentUserName());
       condition.setPaySchId(paySchId);
       try {
    	   result = this.rskCommRecService.toStartRent(condition);
       } catch (BaseException ex) {
           result.setSuccess(BaseConstant.IS_YESNO_NO);
           result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
           BaseLogUtils.info(logger, "toStartRent", "起租提醒外呼错误,Condition:" + JSON.toJSONString(condition) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
       } catch (Exception ex) {
           result.setSuccess(BaseConstant.IS_YESNO_NO);
           result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
           BaseLogUtils.error(logger, "toStartRent", "起租提醒外呼错误,系统错误.Condition:" + JSON.toJSONString(condition) + ".ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
       }
       return result;
   }
   
   
   /**
    * 到付件下载页面
    * @param request
    * @param response
    * @return
    * 
    */
   @RequestMapping(value = "/todownloadPage.do", method = {RequestMethod.GET})
   public ModelAndView todownloadPage(HttpServletRequest request, HttpServletResponse response) {
       String ids = request.getParameter("id");
       ModelAndView view = new ModelAndView("risk/rskCommRec/rskCommdownload");
       view.addObject("dataid", ids);
       
       return view;
   }
   /**
    * 容联外呼系统话单回传
    */
   @RequestMapping(value = "/pushCdrInfoRL.do",method = { RequestMethod.GET ,RequestMethod.POST},  produces = "application/json;charset=UTF-8", consumes = "application/json;charset=UTF-8")
   @ResponseBody
   public String pushCdrInfoRL(HttpServletRequest request,@RequestBody String data)throws BaseException{
   	BaseLogUtils.info(logger,"pushCdrInfo","容联外呼系统话单回传body="+data);
   	JSONObject jsonInfo = new JSONObject();
		
   	try{
   		JSONObject dataJson = JSONObject.parseObject(data);
   		JSONArray cdrList = JSONArray.fromObject(dataJson.get("recordList"));
   		List<RskCommRecDTO> listRskCommRecDTO = new ArrayList<RskCommRecDTO>();   		
   		if(cdrList != null && cdrList.size() > 0){
   			for(int i =0; cdrList.size() > i ; i++){
   				RskCommRecDTO dto = new RskCommRecDTO();
   				//JSONObject jsonObject = (JSONObject) cdrList.get(i);
   				JSONObject jsonObject = (JSONObject)JSONObject.parse(cdrList.getString(i));
   				String crm_uuid=jsonObject.getString("crm_uuid");
   				if (StringUtils.isEmpty(crm_uuid)) {
   					continue;
				}
   				String[] taskid=crm_uuid.split("\\|");
   				if(taskid.length<2||StringUtils.isEmpty(taskid[1]) || 
   						StringUtils.isEmpty(jsonObject.getString("phone")) ){
   					//BaseLogUtils.info(logger, "pushCdrInfoRL", "容联外呼系统话单回传错误- 主要参数为空- data="+cdrList.getString(i), CurrentThreadContext.getCurrentUserName());
   					//普通电话也会推送 so 退出本次循环
   					continue;
   					//return "error--参数为空";
   				}
   				dto.setSerialNum(taskid[1]);
   				dto.setLkPhone(jsonObject.getString("phone"));
   				if (StringUtils.isBlank(jsonObject.getString("duration"))) {
   					dto.setCommSec(0);
				}else {
					dto.setCommSec(Integer.parseInt(jsonObject.getString("duration")));
   				}
   				if(StringUtils.isNotEmpty(jsonObject.getString("recordUrl"))){
   					dto.setRecFileUrl(jsonObject.getString("recordUrl"));
   				}
   				listRskCommRecDTO.add(dto);
   			}
   			if(CollectionUtils.isEmpty(listRskCommRecDTO)){
   				BaseLogUtils.info(logger, "pushCdrInfoRL", "容联外呼系统话单回传 --数据为空", CurrentThreadContext.getCurrentUserName());
   				jsonInfo.put("state", "1");
   				jsonInfo.put("message", "数据为空");
   				return jsonInfo.toJSONString();
   			}
   			DataResultVO resultVo = this.rskCommRecService.updateCommStsByTaskId(listRskCommRecDTO);
   			if(resultVo != null && (resultVo.getSuccess()+"").equals(BaseConstant.IS_YESNO_YES +"")){
   				jsonInfo.put("state", "0");
   				jsonInfo.put("message", "成功");
   				return jsonInfo.toJSONString();
   			}else{
   				BaseLogUtils.info(logger, "pushCdrInfoRL", "容联外呼系统话单回传错误- - data="+data+"error info ="+resultVo.getInfo(), CurrentThreadContext.getCurrentUserName());
   				jsonInfo.put("state", "2");
   				jsonInfo.put("message", resultVo.getInfo());
   				return jsonInfo.toJSONString();
   			}
   		}else{
   			BaseLogUtils.info(logger, "pushCdrInfoRL", "容联外呼系统话单回传错误- 数据为空- data="+data, CurrentThreadContext.getCurrentUserName());
   			jsonInfo.put("state", "1");
			jsonInfo.put("message", "数据为空");
			return jsonInfo.toJSONString();
   		}
   	}catch(Exception e){
           BaseLogUtils.info(logger, "pushCdrInfoRL", "容联外呼系统话单回传错误 data="+data+"错误信息 e="+e.getMessage(), CurrentThreadContext.getCurrentUserName());
           jsonInfo.put("state", "2");
		   jsonInfo.put("message", e.getMessage());
		   return jsonInfo.toJSONString();
   	}
   }
   
}

